<!-- This partial requires local variable 'chapter' -->
<div class="work-show">
<!-- chapter management -->  
  <%- if is_author_of?(@work) -%>
    <ul class="navigation chapter-control">
      <% unless chapter.posted? -%>
        <li><%= link_to 'post'.t, [:post, @work, chapter], :method => :post -%></li>
      <%- end -%>
      <%- if @preview_mode and @preview_mode == true -%>
        <li><%= link_to 'revert to saved'.t, [:edit, @work, chapter] -%></li>
      <%- else -%>
        <li><%= link_to 'edit'.t, [:edit, @work, chapter] -%></li>
      <%- end -%>
      <%- if @work.chapters.count > 1 -%>
        <li><%= link_to 'delete'.t, [@work, chapter], :confirm => 'Are you sure?'.t, :method => :delete %></li>
      <%- end -%>
    </ul>	
  <%- end -%>

<div class="preface chapter">
  <h3 class="title">
    <%= chapter_link(chapter) %>
    <%- unless chapter.title.blank? -%>: <%=h chapter.title %>
    <%- end -%>
  </h3>
<!-- only display byline if different from the main byline -->
  <%- if chapter.pseuds != @work.pseuds -%>
    <h4 class="byline"><%=h 'Chapter by'.t %> <%= byline(chapter) -%></h4>
  <%- end -%>
 
<!-- we want to hide this information by default if javascript is available -->
<%- if (@work.number_of_posted_chapters > 1) || @work.chaptered? -%>
  <%- unless chapter.summary.blank? -%>
  <blockquote class="summary">
    <h3><%=h 'Summary:'.t %></h3>
    <%=sanitize_and_format_for_display chapter.summary -%>
  </blockquote>
  <%- end -%>
  
  <%- unless chapter.notes.blank? -%>
  <blockquote class="notes">
    <h3><%=h 'Notes:'.t %></h3>
    <%=sanitize_and_format_for_display chapter.notes -%>
  </blockquote>
  <%- end -%>
<%- end -%> 
</div>
	
<%=sanitize_and_format_for_display chapter.content %>
  
</div>